<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>路政执法--登录</title>
    <link href="${ctx}/ui/pre/login/css/login.css" rel="stylesheet" type="text/css">
    <!-- 引入jQuery -->
    <script src="${ctx}/ui/jslib/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <!-- 扩展jQuery -->
    <script type="text/javascript" src="${ctx}/ui/jslib/extJquery.js?v=201305301341" charset="utf-8"></script>
    <script type="text/javascript" src="${ctx}/ui/jslib/check.js"></script>
    <script type="text/javascript">
        $(function(){
            createCode();
        });
        function formSubmit(){
            var ajaxCallUrl = '${ctx}/user/logins';
            if(validate()){
                $.ajax({
                    type: "POST",
                    url:ajaxCallUrl,
                    data:$.serializeObject($('#login')),
                    async: false,
                    error: function(request) {
                        alert(request);
                    },
                    success: function(data) {
                        if(data.success){
                            self.location = '${ctx}/user/logintoshow.shtml';
                        }else{
                            alert(data.msg);
                            $("#name").val('');
                            $("#pass").val('');
                            $("#checkNum").val('');
                            createCode();
                        }
                    }
                });
            }else{
                $("#name").val('');
                $("#pass").val('');
                $("#checkNum").val('');
                createCode();
            }
        }
    </script>
</head>

<body>
<div class="login_k">
    <h2>路政执法管理系统</h2>
    <div class="login_k01">
        <div class="login_k02">
            <div class="login_k03">
                <form id="login" action="${ctx}/user/login" method="post">
                    <table width="200" border="0" cellspacing="0" cellpadding="0">
                        <tbody>
                        <tr>
                            <td width="102" align="right"><strong>用户名：</strong></td>
                            <td colspan="2">
                                <input type="text" name="username" id="name"></td>
                        </tr>
                        <tr>
                            <td align="right"><strong>密码：</strong></td>
                            <td colspan="2"><input type="password" name="password" id="pass"></td>
                        </tr>
                        <tr>
                            <td align="right"><strong>验证码：</strong></td>
                            <td width="114"><input type="text" name="textfield3" id="checkNum" style="width:100px;"></td>
                            <td width="144">
      <span id="checkCode" onclick="javascript:createCode()"
            style="color:#100101;border-radius:5px;
      	display:block;float: left;background-color:#FFFFFF;
      	height:20px;line-height:20px;margin-top:5px;
      	font-size:13px;padding:5px;
      	font-family:Georgia, "Times New Roman", Times, serif;font-style:italic;">
                                </span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">&nbsp;</td>
                            <td colspan="2">
                                <a href="#" onclick="javascript:formSubmit();">
                                    <img src="${ctx}/ui/pre/login/images/login_04.png" width="106" height="36" alt=""/>
                                </a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <p>CopyRight © 2014,All Rights Reserved. <br/></p>
</div>
</body>
</html>

